#include<bits/stdc++.h>
using namespace std;
#define LL long long
int qr(){
    int f=1;
    int x=0;
    char c=getchar();
    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
    for(;isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(c^48);
    return x*f;
}
LL N;
LL val[100005];
LL anss;
vector <LL> v1;
void init(){
    N=qr();
    for(int i=1;i<=N;i++){
        int x=qr();
        if(val[x]==0) v1.push_back(x);
        val[x]++;
    }
}
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    init();
    sort(v1.begin(),v1.end());
    int sz=v1.size();
    int last;
    LL add=0;
    LL fir=val[v1[0]];
    last=fir;
    if(v1.size()==1){
        cout<<val[v1[0]];
        return 0;
    }
    for(int i=1;i<=v1.size()-1;i++){
        LL now=val[v1[i]];
        if(now==last){
            anss=anss+last;
            last=0;
            add=0;
        }
        else if(now>last){
            anss=anss+last;
            last=now-last;
            add=last;
            //cout<<'x';
        }
        else if(now<last){
            anss=anss+now;
            last=last-now;
            add=last;
            //cout<<'y';
        }
        //cout<<endl;
        //cout<<anss<<endl;
    }
    //for(int i=v1.size()-1;i>=0;i--) cout<<val[v1[i]]<<endl;
    cout<<anss+add;

}
